<!--快捷回复弹窗-->
<script setup>

import GlobalDialog from "@/components/common/dialog/GlobalDialog.vue";
import PostForm from "@/components/post/PostForm.vue";
import {PostAction} from "@ginstone/nga-api/dist/src/enums/PostAction";
import {useStore} from "vuex";

// 弹窗名称
const name = 'post-form'

const store = useStore();
const closeDialog = () => store.commit("Dialog/closeDialog", name)
</script>

<template>
  <global-dialog :name="name" destroy-on-close>
    <template #default="{data}">
      <post-form v-if="data" :action="data.action" :params="data.params" simple @prepare-error="closeDialog"/>
    </template>
    <template #header="{data}">
      <span>快速</span>
      <span v-if="data.action===PostAction.REPLY && data.params.comment">评论</span>
      <span v-else-if="data.action===PostAction.REPLY">回复</span>
      <span v-else-if="data.action===PostAction.QUOTE">引用</span>
    </template>
  </global-dialog>
</template>

<style scoped>

</style>